
import sys

# 1st argument should be snp-counts.annotated.txt
# 2nd argument should be snp-combined-counts.txt

cached = {}
for line in open(sys.argv[1]):
    if line.startswith("#"): continue
    cols = line.strip().split("\t")
    key = (cols[0], cols[2])
    tail = "\t".join([cols[1]] + cols[3:])
    cached[key] = tail

print >> sys.stderr, "# Read %d lines from %s" % (len(cached), sys.argv[1])

for line in open(sys.argv[2]):
    cols = line.strip().split("\t")
    key = (cols[2], cols[2])
    print "%s\t%s" % (line.strip(), cached[key])
